<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>文件上传</title>
<script >
    function getValue(){
        var x=document.getElementById("infile").value;
        if(x==""){
            alert("请选择文件");
            return false ;
        }
        return true;
    }
</script>
</head>
<body>
基于web中apache fileupload的方法
<form action="/user/fileupload1" method="post" enctype="multipart/form-data">
    选择文件:<input id="infile" type="file" name="upload" /><br>
    <input type="submit" onclick="getValue()" value="确定">
</form>
基于springmvc的的方式
<form action="/user/fileupload2" method="post" enctype="multipart/form-data">
    选择文件:<input  type="file" name="upload" /><br>
    <input type="submit" onclick="getValue()" value="确定">
</form>
跨服务器
<form action="/user/fileupload3" method="post" enctype="multipart/form-data">
    选择文件:<input  type="file" name="upload" /><br>
    <input type="submit" onclick="getValue()" value="确定">
</form>
</body>
</html>
